A study of cubic dihydrides TiH2 and ZrH2 and of H in cubic Laves-phase compounds by means of ab-initio total-energy calculations in the local density-functional approximation is presented. First, for optic vibrational modes in the two dihydrides the calculated local potentials and excitation energies are compared to experimental results obtained by inelastic neutron scattering. Second, the relative stabilities of H on three types of interstitial sites in the cubic Laves-phase compounds, denoted by b, e and g, are investigated. Theoretically, a preference of g sites is found for M=V, Cr, and of e sites for M=Fe, Co. These results are discussed with respect to experimental observations and to empirical criteria for H accomodation in transition-metal compounds.